package com.gitee.francis.lw;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class FormSwagger {
	@Bean
	public Docket createFormRestApi() {
		return new Docket(DocumentationType.SWAGGER_2)
				.groupName("form-module")
				.useDefaultResponseMessages(false)
				.apiInfo(apiInfo())
				.select()
				.apis(RequestHandlerSelectors
						.basePackage("com.hzlemone.form.controller"))
				.paths(PathSelectors.any()).build();
	}

	private ApiInfo apiInfo() {
		return new ApiInfoBuilder().title("表单模块（后台） REST API")
				.description("表单模块。主要包括表单管理，表单项管理，表单值管理。")
				.termsOfServiceUrl("http://192.168.6.15/")
				.contact(new Contact("Francis.LW", "", "francis2lw@163.com"))
				.version("1.0").build();
	}
}
